/**
 * 
 */
package info.niwota.group.thread;

import info.niwota.group.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;

/**
 * @author qiangli
 *
 */
public class ViewTopicActivity extends Activity {

	private String getString(Bundle data, String key) {
		return (data == null ? null : data.getString(key));
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_LEFT_ICON);
		setContentView(R.layout.topic_view);

		TextView viewName = (TextView) findViewById(R.id.topic_view_name);
		TextView viewTitle = (TextView) findViewById(R.id.topic_view_subject);
		TextView viewEmails = (TextView) findViewById(R.id.topic_view_recipient);
		TextView viewBody = (TextView) findViewById(R.id.topic_view_body);

		Bundle extras = getIntent().getExtras();
		String name = getString(extras, Topic.EXTRA_NAME);
		String title = getString(extras, Topic.EXTRA_TITLE);
		String body = getString(extras, Topic.EXTRA_BODY);
		String emails = getString(extras,Topic.EXTRA_EMAILS);

		viewName.setText(name);
		viewTitle.setText(title);
		viewEmails.setText(emails);
		viewBody.setText(body);
		//
		setTitle(R.string.title_topic_view);
		getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
				R.drawable.icon25);
		//
		setResult(Activity.RESULT_OK);
	}
}
